/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Configuracion.java
 *
 * Created on 02/05/2011, 02:47:37 PM
 */
package marquesina;

import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.io.FileNotFoundException;
import java.util.Properties;
import javax.swing.ImageIcon;
import javax.swing.JColorChooser;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import marquesina.marquesina.Marquesina;
import propiedades.Utilitarios;

/**
 *
 * @author kradac
 */
public class Configuracion extends javax.swing.JFrame {

    private JLabel marquesina;
    private int tamano;
    private Utilitarios utilitario = new Utilitarios();
    private Properties arc;
    private int anchoP;
    private int tipoL;
    private Color color;
    private int colorFondo;
    private int colorLetra;
    private String titulo;

    /** Creates new form Configuracion */
    public Configuracion() {
        initComponents();
        configInicial();
    }

    public Configuracion(JLabel texto, int anchoP) {
        this.setIconImage(new ImageIcon(getClass().getResource("/iconos/kradac_icono.png")).getImage());
        initComponents();
        configInicial();
        this.marquesina = texto;
        this.anchoP = anchoP;
        tamano = marquesina.getFont().getSize();
        try {
            arc = utilitario.obtenerArchivoPropiedades("configuracion.properties");
            txtMensaje.setText(arc.getProperty("mensaje"));

            cbxTipoLetra.setSelectedItem(arc.getProperty("fuente"));

            String tam = arc.getProperty("tamano");
            seleccionarItemComboBox(cbxTamano, tam);

            String vel = arc.getProperty("velocidad");
            seleccionarItemComboBox(cbxVelocidad, vel);

            tipoL = Integer.parseInt(arc.getProperty("tipo"));
            seleccionarTipoConfiguracion(tipoL);

            titulo = arc.getProperty("titulo");
            if (!titulo.equals("si")) {
                chkBarraTitulo.setSelected(false);
            } else {
                chkBarraTitulo.setSelected(true);
            }

            try {
                colorLetra = Integer.parseInt(arc.getProperty("colLetra"));
                Marquesina.ponerColorCajaTexto(txtColorLetra, colorLetra);
            } catch (NumberFormatException ex) {
                Marquesina.ponerColorCajaTexto(txtColorLetra, 0);
            }

            try {
                marquesina.setOpaque(true);
                colorFondo = Integer.parseInt(arc.getProperty("colFondo"));
                Marquesina.ponerColorCajaTexto(txtColorFondo, colorFondo);
            } catch (NumberFormatException ex) {
                Marquesina.ponerColorCajaTexto(txtColorFondo, 0);
            }

        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(this, "No se encontró el archivo de configuración", "Error...", 0);
        }
    }

    private void seleccionarTipoConfiguracion(int tipo) {
        switch (tipo) {
            case 1:
                chkNegrita.setSelected(true);
                break;
            case 2:
                chkCursiva.setSelected(true);
                break;
            case 3:
                chkNegritaCursiva.setSelected(true);
                break;
            default:
        }
    }

    private void seleccionarItemComboBox(JComboBox combo, String sel) {
        for (int i = 0; i < combo.getItemCount(); i++) {
            String item = combo.getItemAt(i).toString();
            if (item.equals(sel)) {
                combo.setSelectedIndex(i);
                break;
            }
        }
    }

    private void configInicial() {
        String[] tipoLetra = {"Monospaced",
            "Arial",
            "Serif",
            "Dialog",
            "Segoe Script",
            "Courier New",
            "Calibri",
            "Rockwell"
        };

        for (String fuente : tipoLetra) {
            cbxTipoLetra.addItem(fuente);
        }

        for (int i = 12; i <= 700; i = i + 3) {
            cbxTamano.addItem(i);
        }

        for (int i = 50; i <= 1000; i = i + 50) {
            cbxVelocidad.addItem(i);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        btnSalir = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtMensaje = new javax.swing.JTextArea();
        jLabel4 = new javax.swing.JLabel();
        cbxTipoLetra = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        cbxTamano = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        chkNegrita = new javax.swing.JCheckBox();
        chkCursiva = new javax.swing.JCheckBox();
        chkNegritaCursiva = new javax.swing.JCheckBox();
        cbxVelocidad = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txtColorLetra = new javax.swing.JTextField();
        txtColorFondo = new javax.swing.JTextField();
        chkBarraTitulo = new javax.swing.JCheckBox();
        btnGuardar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Configuración");
        setAlwaysOnTop(true);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Configuración");

        btnSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/salir.png"))); // NOI18N
        btnSalir.setText("Salir");
        btnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirActionPerformed(evt);
            }
        });

        jLabel3.setText("Mensaje:");

        txtMensaje.setColumns(20);
        txtMensaje.setLineWrap(true);
        txtMensaje.setRows(5);
        txtMensaje.setTabSize(0);
        txtMensaje.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jScrollPane2.setViewportView(txtMensaje);

        jLabel4.setText("Tipo de Letra:");

        cbxTipoLetra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxTipoLetraActionPerformed(evt);
            }
        });

        jLabel5.setText("Tamaño:");

        cbxTamano.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxTamanoActionPerformed(evt);
            }
        });

        jLabel6.setText("Estilo:");

        buttonGroup1.add(chkNegrita);
        chkNegrita.setFont(new java.awt.Font("Tahoma", 1, 11));
        chkNegrita.setText("Negrita");
        chkNegrita.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkNegritaActionPerformed(evt);
            }
        });

        buttonGroup1.add(chkCursiva);
        chkCursiva.setFont(new java.awt.Font("Tahoma", 2, 11));
        chkCursiva.setText("Cursiva");
        chkCursiva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkCursivaActionPerformed(evt);
            }
        });

        buttonGroup1.add(chkNegritaCursiva);
        chkNegritaCursiva.setFont(new java.awt.Font("Tahoma", 3, 11));
        chkNegritaCursiva.setText("Negrita y Cursiva");
        chkNegritaCursiva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkNegritaCursivaActionPerformed(evt);
            }
        });

        cbxVelocidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxVelocidadActionPerformed(evt);
            }
        });

        jLabel2.setText("Velocidad:");

        jLabel7.setText("Color de Fondo:");

        jLabel8.setText("Color de Letra:");

        txtColorLetra.setBackground(new java.awt.Color(0, 0, 0));
        txtColorLetra.setEditable(false);
        txtColorLetra.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                txtColorLetraMousePressed(evt);
            }
        });

        txtColorFondo.setEditable(false);
        txtColorFondo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                txtColorFondoMousePressed(evt);
            }
        });

        chkBarraTitulo.setText("Barra de Titulo");
        chkBarraTitulo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkBarraTituloActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(cbxTamano, 0, 68, Short.MAX_VALUE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbxVelocidad, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(cbxTipoLetra, 0, 204, Short.MAX_VALUE))
                        .addContainerGap())
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(chkNegrita)
                                .addGap(18, 18, 18)
                                .addComponent(chkCursiva)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                                .addComponent(chkNegritaCursiva))
                            .addComponent(jLabel6))
                        .addGap(10, 10, 10))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel8))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtColorFondo)
                                    .addComponent(txtColorLetra, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addComponent(chkBarraTitulo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addContainerGap())))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(txtColorLetra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(chkBarraTitulo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(txtColorFondo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(cbxTipoLetra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(cbxVelocidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbxTamano, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chkNegrita)
                    .addComponent(chkNegritaCursiva)
                    .addComponent(chkCursiva))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/guardar.png"))); // NOI18N
        btnGuardar.setText("Guardar");
        btnGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(btnGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
                .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnGuardar, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
                    .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
        this.dispose();
    }//GEN-LAST:event_btnSalirActionPerformed

    private void chkNegritaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkNegritaActionPerformed
        String item = (String) cbxTipoLetra.getSelectedItem();
        marquesina.setFont(new Font(item, Font.BOLD, tamano));
        tipoL = 1;
    }//GEN-LAST:event_chkNegritaActionPerformed

    private void chkCursivaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkCursivaActionPerformed
        String item = (String) cbxTipoLetra.getSelectedItem();
        marquesina.setFont(new Font(item, Font.ITALIC, tamano));
        tipoL = 2;
    }//GEN-LAST:event_chkCursivaActionPerformed

    private void chkNegritaCursivaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkNegritaCursivaActionPerformed
        String item = (String) cbxTipoLetra.getSelectedItem();
        marquesina.setFont(new Font(item, 3, tamano));
        tipoL = 3;
    }//GEN-LAST:event_chkNegritaCursivaActionPerformed

    private void cbxTipoLetraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxTipoLetraActionPerformed
        try {
            String item = (String) cbxTipoLetra.getSelectedItem();
            marquesina.setFont(new Font(item, tipoL, tamano));
            marquesina.setText(Utilitarios.espaciosFrace(marquesina.getText(), tamano, anchoP));
        } catch (NullPointerException ex) {
        }
    }//GEN-LAST:event_cbxTipoLetraActionPerformed

    private void cbxTamanoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxTamanoActionPerformed
        try {
            String item = (String) cbxTipoLetra.getSelectedItem();
            tamano = Integer.parseInt(cbxTamano.getSelectedItem().toString());
            marquesina.setFont(new Font(item, tipoL, tamano));
            marquesina.setText(Utilitarios.espaciosFrace(marquesina.getText(), tamano, anchoP));
        } catch (NullPointerException ex) {
        }
    }//GEN-LAST:event_cbxTamanoActionPerformed

    private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
        String txt = Utilitarios.espaciosFrace(txtMensaje.getText(), tamano, anchoP);
        Marquesina.modificarTexto(txt);

        int vel = Integer.parseInt(cbxVelocidad.getSelectedItem().toString());
        Marquesina.cambiarVelocidad(vel);

        utilitario.escribirProperties("configuracion.properties", "mensaje", txtMensaje.getText());
        utilitario.escribirProperties("configuracion.properties", "fuente", cbxTipoLetra.getSelectedItem().toString());
        utilitario.escribirProperties("configuracion.properties", "tipo", seleccionTipo());
        utilitario.escribirProperties("configuracion.properties", "tamano", cbxTamano.getSelectedItem().toString());
        utilitario.escribirProperties("configuracion.properties", "velocidad", cbxVelocidad.getSelectedItem().toString());
        utilitario.escribirProperties("configuracion.properties", "colLetra", "" + txtColorLetra.getBackground().getRGB());
        utilitario.escribirProperties("configuracion.properties", "colFondo", "" + txtColorFondo.getBackground().getRGB());

        this.dispose();
    }//GEN-LAST:event_btnGuardarActionPerformed

    private void cbxVelocidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxVelocidadActionPerformed
        try {
            int item = Integer.parseInt(cbxVelocidad.getSelectedItem().toString());
            Marquesina.cambiarVelocidad(item);
        } catch (NullPointerException ex) {
        }
    }//GEN-LAST:event_cbxVelocidadActionPerformed

    private void txtColorLetraMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtColorLetraMousePressed
        Color col = Color.ORANGE;
        color = JColorChooser.showDialog(this, "Seleccione un color", col);
        if (color != null) {
            Color letra = new Color(color.getRGB());
            txtColorLetra.setBackground(letra);
            marquesina.setForeground(letra);
        }
    }//GEN-LAST:event_txtColorLetraMousePressed

    private void txtColorFondoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtColorFondoMousePressed
        Color c = new Color(240, 240, 240);
        color = JColorChooser.showDialog(this, "Seleccione un color", c);
        if (color != null) {
            Color fondo = new Color(color.getRGB());
            txtColorFondo.setBackground(fondo);
            marquesina.setBackground(fondo);
            PrincipalGUI.cambiarColorFondo(fondo);
        }
    }//GEN-LAST:event_txtColorFondoMousePressed

    private void chkBarraTituloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkBarraTituloActionPerformed
        if (chkBarraTitulo.isSelected()) {
            utilitario.escribirProperties("configuracion.properties", "titulo", "si");
        } else {
            utilitario.escribirProperties("configuracion.properties", "titulo", "no");
        }
        PrincipalGUI.gui.dispose();
        String parametros[] = {
            "" + PrincipalGUI.gui.getBounds().x,
            "" + PrincipalGUI.gui.getBounds().y,
            "" + PrincipalGUI.gui.getBounds().width,
            "" + PrincipalGUI.gui.getBounds().height
        };
        PrincipalGUI.main(parametros);
    }//GEN-LAST:event_chkBarraTituloActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnGuardar;
    private javax.swing.JButton btnSalir;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox cbxTamano;
    private javax.swing.JComboBox cbxTipoLetra;
    private javax.swing.JComboBox cbxVelocidad;
    private javax.swing.JCheckBox chkBarraTitulo;
    private javax.swing.JCheckBox chkCursiva;
    private javax.swing.JCheckBox chkNegrita;
    private javax.swing.JCheckBox chkNegritaCursiva;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextField txtColorFondo;
    private javax.swing.JTextField txtColorLetra;
    private javax.swing.JTextArea txtMensaje;
    // End of variables declaration//GEN-END:variables

    private String seleccionTipo() {
        if (chkNegrita.isSelected()) {
            return "1";
        } else if (chkCursiva.isSelected()) {
            return "2";
        } else if (chkNegritaCursiva.isSelected()) {
            return "3";
        } else {
            return "0";
        }
    }
}
